package com.sxj.corejava.code08_常用类.泛型;

/**
 * @author 石小俊
 * @date 2024年04月18日 20:20
 */
public class Test02_泛型接口 {

    public static void main(String[] args) {
        Person person = new Person(19, "admin");
        Person person2 = new Person(20, "jack");
        if (person.compareTo(person2) > 0) {
            System.out.println(person.getName() + "比" + person2.getName() + "年龄大");
        } else if (person.compareTo(person2) == 0) {
            System.out.println(person.getName() + "与" + person2.getName() + "年龄一样大");
        } else {
            System.out.println(person.getName() + "比" + person2.getName() + "年龄小");
        }

        User user = new User("admin", 19);
        User user2 = new User("jack", 20);
        if (user.compareTo(user2) > 0) {
            System.out.println(user.getName() + "的名字比" + user2.getName() + "长");
        } else if (user.compareTo(user2) == 0) {
            System.out.println(user.getName() + "的名字与" + user2.getName() + "的名字一样长");
        } else {
            System.out.println(user.getName() + "的名字比" + user2.getName() + "短");
        }
    }

}
